# This Python file uses the following encoding: utf-8
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks

p = None

 
def RecognizitionPipelines():
    global p
    p = pipeline(Tasks.ocr_recognition, model='damo/cv_convnextTiny_ocr-recognition-general_damo')


def runRecognizition():
    global p
    if p is not None:
        result = p('/home/mhc/Code/images/test.png')
        result_str = str(result)  # 转换为字符串
        return result_str
    else:
        return ''


def runRecognizitionArgs(imgPath):
    global p
    if p is not None:
        result = p(imgPath)
        result_str = str(result)  # 转换为字符串
        return result_str
    else:
        return ''


